<?php

/**
 * Application level View Helper
 *
 * This file is application-wide helper file. You can put all
 * application-wide helper-related methods here.
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.View.Helper
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
App::uses('Helper', 'View');

/**
 * Application helper
 *
 * Add your application-wide methods in the class below, your helpers
 * will inherit them.
 *
 * @package       app.View.Helper
 */
class AppHelper extends Helper {
    
    function getModuleIcon($moduleName){ 
        $moduleIconCls = "";
        if($moduleName == 'pages'){
            return 'home';
        }
        $e = 'try{
              App::import("Controller", "'.$moduleName.'");
              if(class_exists("'.$moduleName.'Controller") && !empty('.$moduleName.'Controller::$iconCls)){
                    $moduleIconCls = '.$moduleName.'Controller::$iconCls;
              }else{$moduleIconCls = "card--exclamation";}
              }catch(Exception $err){}';
        //echo "<pre>{$e}</pre>";//exit;
        eval($e);
        return $moduleIconCls;
    }
    
    function getBlockIcon($moduleName, $methodName){   
        $moduleIconCls = "";
        $e = 'try{
              App::import("Controller", "'.$moduleName.'");
              if(class_exists("'.$moduleName.'Controller") && !empty('.$moduleName.'Controller::$'.$methodName.'_iconCls)){
                    $moduleIconCls = '.$moduleName.'Controller::$'.$methodName.'_iconCls;
              }else{$moduleIconCls = "block--exclamation";}
              }catch(Exception $err){}';
        //echo "<pre>{$e}</pre>";exit;
        eval($e);
        return $moduleIconCls;
    }
}
